
#ifndef CAMERA_H
#define CAMERA_H

#include "windows.h"
#include "glu.h"
#include "Vec3f.h"

class Camera {

	public:

		Camera();

		void update();

		void startMouseRotation();		
		void rotateWithMouse(int newX, int newY);
		void rotateWithMouseTargeter(int newX, int newY, int oldX, int oldY);
		void moveToNewTarget(Vec3f targ, const Vec3f* vel, int frames);

		void setEyeVec(Vec3f& eye);
		void setTargetPos(Vec3f& target);
		void setUpVec(Vec3f& up);
		void setZoomDist(float d);
		float getZoomDist();
		void setZoomMinDist(float minDist);
		void incZoomDist(float deltaZoom);

		Vec3f getEyePos();
		Vec3f getTargetPos();
		Vec3f getUpVec();

	private:
		
		Vec3f vEye;
		Vec3f vTarg;
		Vec3f vUp;
		float fDist;
		float fMinDist;

		int iPrevMouseX;
		int iPrevMouseY;
		Vec3f vRotTop;
		Vec3f vRotMid;
		Vec3f vRotBot;

		Vec3f vTargNew;
		Vec3f vTargOrig;
		const Vec3f* vTargAnimEye;
		int iTargAnimCurrFrame;
		int iTargAnimFrames;

		void buildRotationMatrix(const Vec3f& axis, float angle);
		Vec3f rotateVector(const Vec3f& v);
		void doTargAnimFrame();
};

#endif